'use strict';

module.exports = function collectSameElements(collectionA, collectionB) {
  var arr=[];
  // let s1=collectionA.map(function(x){
  //           return Number(x);
  // });
  // let s2=collectionB.map(function(x){
  //   return Number(x);
  // });
 for(var ai=0;ai<collectionA.length;ai++){
   for(var bi=0;bi<collectionB.length;bi++){
     if(collectionA[ai]==collectionB[bi]){
       arr.push(collectionA[ai]);
     }
   }
 }
 console.log(arr);
  return arr;
}
// const collectionA = ['a', 'e', 'h', 't', 'f', 'c', 'g', 'b', 'd'];
// const collectionB = ['a', 'd', 'e', 'f'];
// console.log(collectSameElements(collectionA, collectionB));
